<template>
	<view class="ticket_list" :class="{'lose': item.status != 0}" @click="handleSelect(item)">
		
    <view v-if="item.type == '1'" class="p_font_48 p_color_ff5555 label">
      {{item.discount / 10}}<text style="font-size: 40rpx;margin-left: 8rpx;">折</text>
    </view>
    <view v-else class="p_font_48 p_color_ff5555 label">
      <text style="font-size: 40rpx;margin-right: 8rpx;">¥</text>{{item.deduction_price}}
    </view>
		<view class="line p_margin_r_32"></view>
		<view class="p_flex_1">
			<view class="p_font_32 p_color_ff5555">{{item.ticket_name}}</view>
			<!-- 淘宝好评优惠券单独处理 -->
      <!-- <view class="p_font_24 p_color_ff5555 p_margin_t_8" v-if="item.type == '1'">
      	满￥{{item.limitation_price}}可用</view> -->
			<view class="p_font_24 p_color_ff5555 p_margin_t_8" v-if="!item.id == 'taobao'">
				有效期{{item.star_time?item.star_time: item.create_time}}至{{item.end_time}}</view>
		</view>
		<image src="https://dy.sykj365.com/uploads/mini/shixiao@2x.png" class="p_img_80" v-if="item.status != 0"></image>
		<view class="p_font_26 ticket_btn p_flex8"  @click="$emit('getTicketBtn', item)" v-if="tBtn">
			<view>立即</view>
			<view>领取</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			item: {
				type: Object,
				default: {}
			},
			tBtn: {
				type: Boolean,
				default: false
			},
      ticketType: {
        type: String,
        default: '0'
      }
		},
    methods: {
      handleSelect(item) {
        this.$emit('getC', {...item, ticketType: this.ticketType });
      }
    }
	}
</script>

<style lang="less">
	.ticket_list {
		width: 686rpx;
		height: 144rpx;
		background: url('https://dy.sykj365.com/uploads/mini/youhuiquan1@2x.png') no-repeat center;
		background-size: 100% 100%;
		position: relative;
		display: flex;
		align-items: center;

		&.lose {
			background: url('https://dy.sykj365.com/uploads/mini/youhuiquan2@2x.png') no-repeat center;
			background-size: 100% 100%;
		}

		image {
			right: 32rpx;
			top: 32rpx;
			position: absolute;
		}
	}

	.label {
		width: 192rpx;
    text-align: center;
	}

	.line {
		height: 60%;
		border-left: 1px dashed #ff5555;
	}

	.lose {
		.line {
			border-color: #E8E8E8;
		}

		view {
			color: #b2b2b2 !important;
		}
	}

	.ticket_btn {
		width: 100rpx;
		height: 100%;
		background-color: #FFD700;
		border-radius: 0 16rpx 16rpx 0;
		
		view {
			color: #A0522D;
		}
	}
</style>